#include "head.h"
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
int main(int argc ,char *argv[]){
int fd;
int len;
int arg;
int flags;
flags=argc;
//if(argc==5){
//arg=(int)argv[3]-48;
//}
//else{
 arg=10;
//}
char STR[10000],filename[100];
fd=open(argv[flags-1],O_RDONLY,0);
 if(fd==-1){
     //printf("Fail to open the file");
           perror(argv[flags-1]);
           exit(1);
}
 len=read(fd,&STR,10000);
 if(strcmp(argv[1],"head")==0){
        if(argc==3){
	// if(strcmp(argv[2],"-n")==0){
     myhead(STR,len,arg);
 //}
    }
//else myhead(STR,len,arg);
 }
 if(strcmp(argv[1],"tail")==0){
       if(argc==3){
      mytail(STR,len,arg);
}
}
  close(fd);
}



